package o;

import android.content.Context;
import android.graphics.Rect;
import android.os.Build.VERSION;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager;
import java.util.ArrayList;
import java.util.List;
import o.fne.b;
import o.fne.c;

public class fmz {
    private static int[][] ˊ = new int[][]{new int[]{4, 6, 8}, new int[]{2, 3, 4}, new int[]{4, 6, 8}, new int[]{4, 6, 8}, new int[]{4, 6, 6}, new int[]{2, 2, 2}, new int[]{4, 6, 6}, new int[]{-2, 8, 8}, new int[]{4, 6, 10}, new int[]{-2, 8, 12}, new int[]{2, 2, 2}};
    private static int[][] ˋ = new int[][]{new int[]{4, 6, 8}, new int[]{4, 6, 8}, new int[]{4, 6, 8}, new int[]{4, 6, 8}, new int[]{4, 6, 6}, new int[]{4, 6, 6}, new int[]{4, 6, 6}, new int[]{-2, 8, 8}, new int[]{4, 6, 10}, new int[]{-2, 8, 12}, new int[]{4, 6, 8}};
    private static int[][] ˎ = new int[][]{new int[]{24, 24, 24}, new int[]{12, 12, 12}, new int[]{12, 12, 12}, new int[]{8, 8, 8}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}};
    private static int[][] ˏ = new int[][]{new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{8, 8, 8}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}, new int[]{24, 24, 24}};
    private static final String ॱ = fmz.class.getSimpleName();
    private int ʻ;
    private int ʼ;
    private int ʽ = -1;
    private float ˊॱ;
    private int ˋॱ;
    private int ˏॱ;
    private float ͺ;
    private int ॱˊ;
    private int ॱˋ;
    private Context ॱˎ;
    private float ॱॱ;
    private fmv ॱᐝ;
    private List<Integer[]> ᐝ = new ArrayList();
    private int ᐝॱ = 4;

    public fmz(Context context) {
        this.ॱˎ = context;
        ˋ();
    }

    public fmz(Context context, int i) {
        this.ʽ = i;
        this.ॱˎ = context;
        ˋ();
    }

    public int ˊ() {
        return this.ॱᐝ.ˏ();
    }

    private void ˋ() {
        DisplayMetrics displayMetrics = this.ॱˎ.getResources().getDisplayMetrics();
        this.ʻ = displayMetrics.widthPixels;
        this.ʼ = displayMetrics.heightPixels;
        if (VERSION.SDK_INT > 28) {
            Rect ˊ = fmx.ˊ();
            if (ˏ(this.ॱˎ) && (ˊ.left > 0 || ˊ.right > 0)) {
                this.ʻ = (ˊ(this.ॱˎ.getResources().getConfiguration().screenWidthDp, displayMetrics.density) - ˊ.left) - ˊ.right;
            }
        }
        this.ॱॱ = displayMetrics.density;
        this.ͺ = displayMetrics.xdpi;
        this.ˊॱ = displayMetrics.ydpi;
        ॱᐝ();
        this.ॱᐝ = new fmy();
        this.ॱᐝ.ˏ(this.ʻ, this.ʼ, this.ॱॱ);
        this.ॱᐝ.ˏ(this.ˋॱ, this.ॱˊ, this.ˏॱ, this.ॱˋ, this.ᐝॱ);
    }

    private boolean ˏ(Context context) {
        int rotation;
        if (context != null) {
            WindowManager windowManager = (WindowManager) context.getSystemService("window");
            if (windowManager != null) {
                rotation = windowManager.getDefaultDisplay().getRotation();
                return rotation != 0 || rotation == 2;
            }
        }
        rotation = 0;
        if (rotation != 0) {
        }
    }

    private void ˏ(int i, int i2, float f) {
        if (i < 0 || i >= ˊ.length) {
            i = 0;
        }
        this.ˋॱ = ˊ(ˏ[i][i2], f);
        this.ॱˊ = ˊ(ˎ[i][i2], f);
        this.ˏॱ = ˊ[i][i2];
        this.ॱˋ = ˋ[i][i2];
    }

    private void ˏ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ʽ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ʻ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ʼ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ᐝ);
    }

    private void ʻ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ॱ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ˎ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ˊ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ॱ);
    }

    private void ʽ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ʼ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ॱॱ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ʽ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ʻ);
    }

    private void ᐝ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ˈ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ʿ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ˈ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ʽॱ);
    }

    private void ॱॱ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ॱᐝ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ͺ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ˊॱ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ᐝॱ);
    }

    private void ʼ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ॱˎ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ʻॱ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ʻॱ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ॱˎ);
    }

    private void ͺ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ˋॱ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ˏॱ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ˏॱ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ͺ);
    }

    private void ॱˊ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ᐝॱ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ॱˋ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ॱᐝ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ॱˋ);
    }

    private void ˏॱ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ˊॱ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ॱˊ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ॱˊ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ˋॱ);
    }

    private void ˋॱ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ᐝ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ˏ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ˎ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ॱॱ);
    }

    private void ˊॱ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ˋ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ˊ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ˋ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ˏ);
    }

    private void ᐝॱ() {
        this.ˋॱ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ʽ);
        this.ॱˊ = this.ॱˎ.getResources().getDimensionPixelOffset(c.ʻ);
        this.ˏॱ = this.ॱˎ.getResources().getInteger(b.ʼ);
        this.ॱˋ = this.ॱˎ.getResources().getInteger(b.ᐝ);
    }

    private void ॱ(float f, float f2) {
        int i;
        if (f >= 840.0f) {
            this.ᐝॱ = 12;
            i = 2;
        } else if (f >= 600.0f) {
            this.ᐝॱ = 8;
            i = 1;
        } else {
            this.ᐝॱ = 4;
            i = 0;
        }
        ˏ(this.ʽ, i, f2);
    }

    private void ॱᐝ() {
        if (this.ॱˎ != null) {
            this.ᐝॱ = this.ॱˎ.getResources().getInteger(b.ʾ);
            switch (this.ʽ) {
                case -1:
                case 0:
                    ˏ();
                    return;
                case 1:
                    ʻ();
                    return;
                case 2:
                    ʽ();
                    return;
                case 3:
                    ˋॱ();
                    return;
                case 4:
                    ˊॱ();
                    return;
                case 5:
                    ᐝ();
                    return;
                case 6:
                    ʼ();
                    return;
                case 7:
                    ͺ();
                    return;
                case 8:
                    ॱˊ();
                    return;
                case 9:
                    ˏॱ();
                    return;
                case 10:
                    ॱॱ();
                    return;
                default:
                    ᐝॱ();
                    return;
            }
        }
    }

    public void ॱ(int i) {
        this.ʽ = i;
        if (this.ॱˎ != null && this.ॱᐝ != null) {
            ॱᐝ();
            this.ॱᐝ.ˏ(this.ˋॱ, this.ॱˊ, this.ˏॱ, this.ॱˋ, this.ᐝॱ);
        }
    }

    public int ˎ() {
        return this.ॱᐝ.ˎ();
    }

    public int ॱ() {
        return this.ॱᐝ.ॱ();
    }

    public int ˋ(Context context) {
        this.ॱˎ = context;
        if (this.ॱˎ == null) {
            return ˊ();
        }
        DisplayMetrics displayMetrics = this.ॱˎ.getResources().getDisplayMetrics();
        if (!(displayMetrics.widthPixels == this.ʻ && displayMetrics.density == this.ॱॱ)) {
            ˋ();
        }
        return ˊ();
    }

    public int ˊ(Context context, int i, int i2, float f) {
        if (i <= 0 || f <= 0.0f) {
            Log.w(ॱ, "width and density should not below to zero!");
            return ˊ();
        }
        this.ॱˎ = context;
        ॱ(((float) i) / f, f);
        if (this.ॱᐝ == null) {
            this.ॱᐝ = new fmy();
        }
        this.ʻ = i;
        this.ʼ = i2;
        this.ॱॱ = f;
        this.ॱᐝ.ˏ(i, i2, f);
        this.ॱᐝ.ˏ(this.ˋॱ, this.ॱˊ, this.ˏॱ, this.ॱˋ, this.ᐝॱ);
        this.ॱᐝ.ˊ();
        return ˊ();
    }

    private int ˊ(int i, float f) {
        return (int) ((((float) i) * f) + 0.5f);
    }
}
